package com.songlin.houxin.admin.api.vo;


import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.io.Serializable;
import java.util.List;

/**
 * @author jinYuLinLang
 * @version 1.0.0
 * @ClassName BasePageVO.java
 * @Description <p></p>
 * @createTime 2022-03-06 10:02:00
 */
@Data
@ApiModel(value = "基础分页出参信息", description = "基础分页出参信息")
public class BasePageVO<T> implements Serializable {

    @ApiModelProperty(value = "分页列表")
    private List<T> list;

    @ApiModelProperty(value = "总记录数")
    private Long total;

    private BasePageVO(List<T> list, Long total) {
        this.list = list;
        this.total = total;
    }

    /**
     * 封装已知类型的
     *
     * @param list  list列表
     * @param total 总数
     * @param <T>   返回值泛型
     * @return
     */
    public static <T> BasePageVO<T> instance(List<T> list, Long total) {
        return new BasePageVO<>(list, total);
    }
}
